package cn.tedu.controller;

import cn.tedu.pojo.Car;
import cn.tedu.service.CarService;
import cn.tedu.service.CarServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("car")
public class CarController {

    @Autowired//spring di 依赖注入的关系，自动装配
    CarService carService;

    @RequestMapping("get")
    public Car get(){
        //业务都放在Service层，直接调用就行
        return carService.get();
    }
    @RequestMapping("add")
    public void add(Car car) throws Exception {
        carService.add(car);
    }
    @RequestMapping("updata")
    public void show(Car car) throws Exception {
        carService.updata(car);
    }
}
